<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
  <div class="container">
    <a class="navbar-brand" routerLink="/">Form.io Authentication</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
          <a class="nav-link" routerLink="/"><i class="fa fa-home"></i> Home</a>
        </li>

        <li class="nav-item" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}" *ngIf="auth.authenticated">
          <a class="nav-link" routerLink="/dashboard">Dashboard</a>
        </li>
      </ul>

      <ul class="nav navbar-nav ml-auto">
        <li class="nav-item dropdown" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}" *ngIf="!auth.authenticated">
          <a class="nav-link dropdown-toggle" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" >
            Access
          </a>
          <div class="dropdown-menu" aria-labelledby="navbarDropdown">
            <a class="dropdown-item" routerLink="/auth/login">Login</a>
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" routerLink="/auth/register">Register</a>
          </div>
        </li>

        <li class="nav-item dropdown" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}" *ngIf="auth.authenticated">
          <a class="nav-link dropdown-toggle" id="navbarDropdown2" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            {{ userEmail }}
          </a>
          <div class="dropdown-menu" aria-labelledby="navbarDropdown">
            <div class="dropdown-divider"></div>
            <a class="dropdown-item" routerLink="/auth/login" (click)="auth.logout()">Logout</a>
          </div>
        </li>
      </ul>
    </div>
  </div>
</nav>
